<?php

class tmenu_edit extends SClass {

    public function process() {

        try {
            $post = ServiceUtils::GetFactory()->getTmenuService()->getTmenuByID(
                            $this->getArgument('id')
            );

            if ($this->getControlValue('ok')) {
                ServiceUtils::GetFactory()->getTmenuService()->editTmenu(
                         $this->getArgument('id'),
                        $this->getControlValue('name'),
                        $this->getControlValue('url'),
                        $this->getControlValue('pos')
                );
                $this->assign('message', 'ok');

             } else {
                $this->setControlValue('name', $post->getName());
                $this->setControlValue('url', $post->getURL());
                $this->setControlValue('pos', $post->getPosition());
           //     $this->getControlValue('chek', $post->getBlessed());

            }
        } catch (ServiceUtils_Exception $e) {
            $this->assign('errors', $e->getErrors());
        }
    }

}